# 行间距、字体格式的设置
from docx import Document
from docx.shared import Length
from docx.shared import Pt

document = Document()
paragraph = document.add_paragraph()
paragraph_format = paragraph.paragraph_format
print(paragraph_format.line_spacing)  # 获取默认行间距
paragraph.add_run('获取默认行间距').add_break()
paragraph.add_run('获取默认行间距获取默认行间距获取默认行间距').add_break()

paragraph_format.line_spacing = Pt(40)
print(paragraph_format.line_spacing.pt)
paragraph.add_run('设置后的间距，获取默认行间距').add_break()
paragraph.add_run('设置后的间距，获取默认行间距获取默认行间距获取默认行间距').add_break()

document.save('修改行间距.docx')